<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>管理员登录</title>
    <link href="../../rs/css/login.css" rel="stylesheet">
</head>
<body>
<img src="../../rs/img/reg-bg.png" alt="" width="100%" height="100%" class="bg-img">
<div id="overlay"></div>
<div id="loginContent">
    <div class="wrap">
        <div id="loginLogo" class="loginLogo"></div>
        <div id="loginBox" class="loginBox ">
            <div class="clear login-box-title">
                <h1 class="logo-name">DY后台登录</h1>
            </div>

            <div class="login-content" id="loginWrap">
                <div id="userPwdLogin" class="userpwd-login">
                    <div name="submitForm_new"   >
                    <ul id="userlogin_ul" class="formInput">
                        <!---用户名-->
                        <li class="usernameliUser">

                            <input type="text" value="" id="usernameUser" autocomplete="off" name="bh" size="20" class="passport-login-input username_new inputNull" maxlength="" placeholder="用户名">
                        </li>
                        <!--密码-->
                        <li class="passwordliUser">

                            <input class="passport-login-input password_new inputNull" type="password" autocomplete="off" name='mm'   size="20" maxlength="16" placeholder="密码" style="display: inline-block;">
                        </li>
                        <li class="submit_new">
                            <input type="submit" onclick="login_in()" class="submit" name="btnSubmit" value="登录" accesskey="l">
                        </li>
                    </ul>
                </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../../rs/js/jquery.min.js"></script>
<script src="../../rs/js/bootstrap.js"></script>
<script src="../../rs/plugins/layer/layer.js"></script>
<script src="../../rs/js/jquery.cookie.js"></script>
<script src="../../rs/js/common_qj.js"></script>
<script type="text/javascript">
    function GetRequest() {
        var url = location.search; //获取url中"?"符后的字串
        var str = "";
        if (url.indexOf("?") != -1) {
            str = url.substr(1);
        }
        return str;
    }
     var cobh=GetRequest();
     var f_valid = function(){
        var bh = $.trim($("input[name='bh']").val()) ;
        if( bh =='') {
            layer.msg('请输入用户编号');
            return false;
        }

        var mm = $.trim($("input[name='mm']").val()) ;
        if( mm =='') {
            layer.msg('请输入用户密码');
            return false;
        }
        return true;
    };


    function login_in(){
         
         var bh=$("input[name='bh']").val();
            var mm=$("input[name='mm']").val();
            if (!f_valid()) return;
            layer.load(2);
            $.post(G_url+"login/signin", "cobh="+cobh+"&bh="+bh+"&mm="+mm, function(data) {
                var ret = JSON.parse(data);//将 JSON 字符串转换成对象
                var bh=$("input[name='bh']").val();
                var user= ret.user;
                if(ret.ok){
                   // 存储 cookie
                    $.cookie('sign', ret.sign);
                    //存储bh的明文
                    $.cookie('bh',bh);
                    //存储mc的明文
                    $.cookie('mc', user.mc);

                    window.location.href = "index.php";
                }else {
                    layer.closeAll();
                    layer.msg(ret.msg);
                }
            });
    }

	$("input[name='mm']").bind('keypress',function(event){
         
		if(event.keyCode == "13") {
			login_in();
		}
	});




</script>
</body>

</html>
